package com.paddyi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.paddyi.model.Stock;
import com.paddyi.mapper.StockMapper;
import com.paddyi.service.IStockService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 *  (Stock)
 * @author paddy
 * @since  2019-08-09 12:00:53
 */
@Service
public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements IStockService {

    @Autowired
    StockMapper stockMapper;

    @Override
    public boolean place(Stock stock) {
        int rows = stockMapper.place(stock);
        if(rows !=1){
            throw new RuntimeException();
        }
        return true;
    }

    @Override
    public List<Stock> findAll() {
        return null;
    }

    public boolean confirm(Stock stock) {
        final int rows = stockMapper.confirm(stock);
        return Boolean.TRUE;
    }

    public boolean cancel(Stock stock) {
        final int rows = stockMapper.cancel(stock);
        if (rows != 1) {
        }
        return Boolean.TRUE;
    }
}
